package com.wf.course.service.impl;

import com.utils.page.PageBean;
import com.wf.course.dao.IAdvertisementMapper;
import com.wf.course.model.comm.Advertisement;
import com.wf.course.service.IAdvertisementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Auther: liu
 * @Date: 2018/6/12 19:00
 * @Description: 广告管理
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class IAdvertisementServiceImpl implements IAdvertisementService {

    @Autowired
    private IAdvertisementMapper advertisementMapper;

    @Override
    public void list(PageBean<Advertisement> pageBean) {
        pageBean.setResults(advertisementMapper.list(pageBean));
        pageBean.setTotalCount(advertisementMapper.count(pageBean));
    }

    @Override
    public Integer add(Advertisement advertisement) {
        return advertisementMapper.add(advertisement);
    }

    @Override
    public Integer update(Advertisement advertisement) {
        return advertisementMapper.update(advertisement);
    }

    @Override
    public Integer delete(Integer id) {
        return advertisementMapper.delete(id);
    }

    @Override
    public Advertisement getAdvertisementById(Integer id) {
        return advertisementMapper.getAdvertisementById(id);
    }
}
